package L610;


public class WeiShuSum {
    public static void main(String[] args) {
        int sum = sum(456);
        System.out.println(sum);

    }

    public static int sum(int n) {
//        123
        int sum = 0;
        while (n!= 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;
    }
}
